package StudyCode.summary.aclfile;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class ReadsFileCount {
	public static void main(String[] arguments) {
		try {
			FileInputStream file = new FileInputStream("400primes.dat");
			boolean eof = false;
			int size = 0;
			while (!eof) {
				int input = file.read();
				if (input == -1) {
					eof = true;
				} else {
					size++;
				}
			}
			file.close();
			FileOutputStream outFile = new FileOutputStream("400primes.dat");
			for (int i = 0; i < size; i++) {
				outFile.write((byte) 0);
			}
			outFile.close();
			System.out.println("用 0 覆盖所有字节成功");
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
